package com.bph.preference.service.impl;


import com.bph.commons.pojo.User;
import com.bph.commons.vo.ResultVo;
import com.bph.preference.mapper.PreferenceMapper;
import com.bph.preference.service.PreferenceService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@Service
public class PreferenceServiceImpl implements PreferenceService {
    @Resource
    PreferenceMapper preferenceMapper;

    //根据邮箱获得偏好信息
    @Override
    public ResultVo selectPreferenceByMail(User user) {

        List<Map> maps = preferenceMapper.selectPreferenceByMail(user);
        if(maps.size() == 0){
            return ResultVo.getFailVo("获取偏好信息失败",2);
        }
        else{
            return ResultVo.getSuccessVo("获取偏好信息成功",maps);
        }
    }
}
